home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: File Size!
- Date: Tue, 23 Jan 96 13:12:31 GMT
- Organization: none
- Message-ID: <822402751snz@genesis.demon.co.uk>
- References: <4e11ph$733@hammerhead.dadd.ti.com> <4e2fh6$1n4@comet.connix.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4e2fh6$1n4@comet.connix.com>
- shawley@connix.com "Scott Hawley" writes:
-
- >
- >write a script to use the -l option but only display the size. It should
- >take about 1 minuite to write the script.
- >hint1: ls | cut
- >or
- >hint2: ls | awk
-
- It would be *extremely* poor C code that shell'd out to execute ls and
- cut/awk just to find a file size. The standard C method is to use
- fopen/fseek/ftell where SEEK_END is supported. The Unix/POSIX approach is
- to use stat/fstat which is a lot more efficient (and also more portable)
- than using external commands.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-